package com.rtos.model.process.queue;

import com.rtos.model.process.Process;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

/**
 * @Author: biubiu0002
 * @Date: 2021-08-30 23:48
 **/
public class BlockingQueue {
    public static ObservableList<Process> blockingQueue = FXCollections.observableArrayList();

    public synchronized static ObservableList<Process> getList() {
        return blockingQueue;
    }

    public synchronized static void add(Process process) {
        blockingQueue.add(process);
    }

    public synchronized static Process getFirst() {
        return blockingQueue.get(0);
    }

    public synchronized static Process get(int index) {
        return blockingQueue.get(index);
    }

    public synchronized static int size() {
        int size = blockingQueue.size();
        return size;
    }

    public synchronized static Process remove(int index) {
        Process process = blockingQueue.get(index);
        blockingQueue.remove(index);
        return process;
    }

    public synchronized static void remove(Process process) {
        blockingQueue.remove(process);
    }



}
